#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_mixer.h>
#include <assert.h>
#include "SDL\jeu.h"
#include <string.h>

void Resultat(int res,int *pcontinuer, int Nummap)
{
int continuer3=1,i=1;
SDL_Rect position_fond_base;
position_fond_base.x=0;
position_fond_base.y=0;
SDL_Event event;
SDL_Surface *ecrandebut = NULL, *fond_base= NULL;
SDL_Init(SDL_INIT_VIDEO);

ecrandebut= SDL_SetVideoMode(700, 719, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
if (res==0)
{
fond_base= IMG_Load("gagner1.jpg");
}
else
{
fond_base = IMG_Load("echec1.jpg");
}
SDL_BlitSurface(fond_base, NULL, ecrandebut,&position_fond_base);
SDL_Flip(ecrandebut);


    while (continuer3)
    {
if (res==0)
{
switch (i){
case 1 : fond_base= IMG_Load("gagner1.jpg");break;
case 2 : fond_base= IMG_Load("gagner2.jpg");break;
case 3 : fond_base= IMG_Load("gagner3.jpg");break;
case 4 : fond_base= IMG_Load("gagner4.jpg");break;
}
}
else
{
switch (i){
case 1 : fond_base= IMG_Load("echec1.jpg");break;
case 2 : fond_base= IMG_Load("echec2.jpg");break;
case 3 : fond_base= IMG_Load("echec3.jpg");break;
case 4 : fond_base= IMG_Load("echec4.jpg");break;
}
}
SDL_BlitSurface(fond_base, NULL, ecrandebut,&position_fond_base);
   SDL_Flip(ecrandebut);
    SDL_WaitEvent(&event);
    switch (event.type)
     {
      case SDL_QUIT : continuer3=0;*pcontinuer=0;break;
   case SDL_KEYDOWN :
          switch(event.key.keysym.sym)
          {
case SDLK_UP :
if (i==1)
{
i=4;
}
else
{
i--;
}
break;
case SDLK_DOWN :
if (i==4)
{
i=1;
}
else
{
i++;
}
break;

case SDLK_RETURN :
switch (i){
case 1 : Chargement(1,Nummap);break;
case 2 : ChoixMap(1);break;
case 3 : Menu();break;
case 4 : continuer3=0;*pcontinuer=0;break;
}
break;

         }



break;

     }
  SDL_FreeSurface(fond_base);

    }



SDL_FreeSurface(fond_base);
SDL_FreeSurface(ecrandebut);
}
